import sys
import datetime
sys.path.append("../")
from ansible_files.ansibleApi import *  # 导入 ansible api

sources = '../ansible_files/scripts/inventory'
extra_vars = {'content': 'This param is from outside.   '}
tasks = []
# 测试 ansible_api
playbooks = ['../ansible_files/playbooks/test_debug.yml',]
tasks.append(dict(action=dict(module='debug', args=dict(msg='{{ content }}'))))

# AnsibleApi("AnsibleApi-%s", "localhost", tasks, sources, extra_vars)
AnsiblePlaybookApi(
            "AnsiblePlayBookApi-%s" % datetime.datetime.now().strftime("%Y%m%d-%H%M%S"),
            playbooks, sources, extra_vars
        )